home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat4 / dmedia / cdframe.z / cdframe
Encoding:
Text File  |  1998-10-20  |  12.5 KB  |  265 lines

  1.  
  2.  
  3.  
  4. CCCCDDDDFFFFRRRRAAAAMMMMEEEE((((4444))))                                                          CCCCDDDDFFFFRRRRAAAAMMMMEEEE((((4444))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      cdframe - structure of a frame of audio data on Compact Disc (CD)
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ccccddddaaaauuuuddddiiiioooo....hhhh>>>>
  13.  
  14. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  15.      Audio on Compact Discs (CD) is blocked into _f_r_a_m_e_s.  The CD has 75 frames
  16.      each second.  One frame of data contains both audio and non-audio data
  17.      (known as subcodes).  These frames are frequently referred to as
  18.      _s_u_b_c_o_d_e-_f_r_a_m_e_s because it takes one complete frame to assemble all the
  19.      bits of a chunk of subcode.  A program reading a CD in audio mode must
  20.      read a minimum of one CD frame.  This is enforced by the function
  21.      _C_D_r_e_a_d_d_a(_3) in _l_i_b_c_d_a_u_d_i_o.
  22.  
  23.      The _c_d_f_r_a_m_e structure, describing the content of a frame of CD data, is
  24.      defined in <<<<ccccddddaaaauuuuddddiiiioooo....hhhh>>>> as follows:
  25.  
  26.               typedef struct cdframe {
  27.                   char audio[CDDA_DATASIZE];
  28.                   struct subcodeQ subcode;
  29.               } CDFRAME;
  30.  
  31.  
  32.    AAAAuuuuddddiiiioooo DDDDaaaattttaaaa
  33.      Audio samples in the _a_u_d_i_o array are linearly encoded in a 16-bit 2's
  34.      complement format.  Encoding is carried out either without pre-emphasis
  35.      or with a first order 50/15 Ms pre-emphasis.  The data stream contains
  36.      two interleaved channels, usually used as the left and right channels of
  37.      a stereo pair.  The sample representing the left channel is first,
  38.      followed by the sample representing the right channel. The sampling
  39.      frequency is 44.1 kHz and both channels are sampled simultaneously during
  40.      recording.
  41.  
  42.      The least significant byte of each 16-bit value is first.  The bytes need
  43.      to be swapped in order to match the native byte ordering of the IRIS
  44.      Indigo and Personal IRIS 4D/35 and their audio hardware.  So each 4-byte
  45.      chunk of the data array represents a pair of samples (1 left plus 1
  46.      right) as follows.  Byte 0 is the least significant byte of the left
  47.      channel sample; byte 1 is the most significant byte of the left channel
  48.      sample.  Byte 2 is the least significant byte of the simultaneous right
  49.      channel sample; byte 3 is the most significant byte of the simultaneous
  50.      right channel sample.
  51.  
  52.      CDDA_DATASIZE is 2352 bytes.
  53.  
  54.    SSSSuuuubbbbccccooooddddeeeessss
  55.      The _s_u_b_c_o_d_e_Q structure contains information from the Q subcode fields
  56.      recorded on the CD.  CD's also have subcode fields P and R through W.  P
  57.      subcodes provide a simple track separator intended for use by low cost
  58.      players.  They have no useful purpose when the player is able to read and
  59.      process the Q subcodes.  Subcodes R through W are not yet fully defined
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. CCCCDDDDFFFFRRRRAAAAMMMMEEEE((((4444))))                                                          CCCCDDDDFFFFRRRRAAAAMMMMEEEE((((4444))))
  71.  
  72.  
  73.  
  74.      and some CD-ROM drives do not read them.  The subcodeQ structure is
  75.      defined in _c_d_a_u_d_i_o._h as follows:
  76.  
  77.               typedef struct subcodeQ {
  78.                   unchar control;
  79.                   unchar type;
  80.                   union {
  81.                       struct {
  82.                           struct cdpackedbcd { unchar dhi:4, dlo:4; } track;
  83.                           struct cdpackedbcd index; /* aka point during trk 0 */
  84.                           struct cdtimecode {
  85.                               unchar mhi:4, mlo:4;
  86.                               unchar shi:4, slo:4;
  87.                               unchar fhi:4, flo:4;
  88.                           } ptime;
  89.                           struct cdtimecode atime;
  90.                           unchar fill[6];
  91.                       } mode1;
  92.                       struct {
  93.                           unchar catalognumber[13];
  94.                           struct cdpackedbcd aframe;
  95.                       } mode2;
  96.                       struct {
  97.                           struct cdident {
  98.                               unchar country[2];
  99.                               unchar owner[3];
  100.                               unchar year[2];
  101.                               unchar serial[5];
  102.                           } ident;
  103.                           struct cdpackedbcd aframe;
  104.                           unchar fill;
  105.                       } mode3;
  106.                   } data;
  107.               } CDSUBCODEQ;
  108.  
  109.  
  110.      The ccccoooonnnnttttrrrroooollll field contains 4 flag bits in its least significant nibble to
  111.      define the kind of information in a track (program item).
  112.  
  113.               0 0 X 0 - 2 audio channels without pre-emphasis
  114.               0 0 X 1 - 2 audio channels with pre-emphasis of 50/15 Ms
  115.               0 X 0 X - copy prohibited
  116.               0 X 1 X - copy permitted
  117.  
  118.  
  119.      The bits of the control field can only change during an actual pause
  120.      (iiiinnnnddddeeeexxxx....ddddhhhhiiii,,,, iiiinnnnddddeeeexxxx....ddddlllloooo == 00) of at least 2 s or during the lead-in area.
  121.  
  122.      Notes 1. -
  123.           The four bits of the control field should be copied to the control
  124.           field of the channel status of the digital audio interface for
  125.           domestic use.
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. CCCCDDDDFFFFRRRRAAAAMMMMEEEE((((4444))))                                                          CCCCDDDDFFFFRRRRAAAAMMMMEEEE((((4444))))
  137.  
  138.  
  139.  
  140.      Notes 2. -
  141.           For non-audio applications of the compact disc the following control
  142.           codes have been defined:
  143.  
  144.  
  145.  
  146.               0 1 X 0 - digital data
  147.               1 X X X - broadcasting use
  148.  
  149.  
  150.           All other combinations will be defined later on.
  151.  
  152.      The ttttyyyyppppeeee field contains 4 address-bits in its least significant nibble
  153.      that identify the type of the data field which is a union of three
  154.      possible types.
  155.  
  156.                0001 - mode 1
  157.                0010 - mode 2
  158.                0011 - mode 3
  159.  
  160.  
  161.    MMMMooooddddeeee 1111 QQQQ DDDDaaaattttaaaa
  162.      Mode 1 data contains track numbering and time code information. All
  163.      numbers are encoded as BCD digits.  ttttrrrraaaacccckkkk is the number of the current
  164.      track.  It is two BCD digits packed into a single byte.  The most
  165.      significant digit, dddd1111,,,, is in the most significant nibble.  Audio program
  166.      tracks are numbered from 01 - 99.  Track number 00 is the lead-in track.
  167.      Track number AA (each BCD digit has the bit-pattern 1010) is the lead-out
  168.      track.
  169.  
  170.      Tracks may be subdivided into sections; each section has a unique index
  171.      number.  iiiinnnnddddeeeexxxx is the index number of the current subdivision within the
  172.      track.  Its representation is identical with ttttrrrraaaacccckkkk.... Regular subdivisions
  173.      are numbered from 01 - 99.  The first subdivision within a track must be
  174.      numbered 01.  The index number increases in increments of 1.  Index
  175.      number 00 indicates a pause and coincides with actual pauses (gaps
  176.      between tracks) in the audio program.  During index number 00, ttttrrrraaaacccckkkk is
  177.      the number of the track that follows the pause.  The first audio track is
  178.      preceded by a pause encoding of 2 s to 3 s.
  179.  
  180.      During the lead-out track the subdivision number is 01.
  181.  
  182.      During the lead-in track a table of contents is recorded in the mode 1
  183.      subcodes.  During this time, the index number field, now known as _P_o_i_n_t,
  184.      records a track number.  The aaaattttiiiimmmmeeee field (see below) gives the starting
  185.      position of the track given by _p_o_i_n_t. Several special track numbers are
  186.      also valid at this time.  If _p_o_i_n_t = A0 the minutes field of aaaattttiiiimmmmeeee
  187.      contains the track number of the first track on the disk.  The seconds
  188.      and frame fields are zero.  If _p_o_i_n_t = A1 the minutes field of aaaattttiiiimmmmeeee
  189.      contains the track number of the last track on the disk.  The seconds and
  190.      frame fields are zero.  If _p_o_i_n_t = A2 aaaattttiiiimmmmeeee contains the starting point
  191.      of the lead-out track.
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. CCCCDDDDFFFFRRRRAAAAMMMMEEEE((((4444))))                                                          CCCCDDDDFFFFRRRRAAAAMMMMEEEE((((4444))))
  203.  
  204.  
  205.  
  206.      In normal use (i.e. except during lead-in) ppppttttiiiimmmmeeee is the time into the
  207.      current program (track).  aaaattttiiiimmmmeeee is the time from the start of the disc.
  208.      In the _c_d_t_i_m_e_c_o_d_e structure, mmmmhhhhiiii and mmmmlllloooo are the current minute, sssshhhhiiii and
  209.      sssslllloooo are the current second and ffffhhhhiiii and fffflllloooo are the current frame. Frame
  210.      numbers run from 00 to 74.
  211.  
  212.    MMMMooooddddeeee 2222 QQQQ DDDDaaaattttaaaa
  213.      Mode 2 data contains the catalogue number of the disc.  ccccaaaattttaaaallllooooggggnnnnuuuummmmbbbbeeeerrrr is
  214.      expressed in 13 BCD digits according to the UPC/EAN code.  The catalogue
  215.      number does not change on a disk.  If no catalogue number is recorded
  216.      these BCD digits are all zero.
  217.  
  218.      aaaaffffrrrraaaammmmeeee contains the continuation of the absolute frame numbering from
  219.      mode 1.  This allows an uninterrupted flow of frame numbers.  It contains
  220.      two packed BCD digits.
  221.  
  222.    MMMMooooddddeeee 3333 QQQQ DDDDaaaattttaaaa
  223.      Mode 3 data is used to give a unique identification to an audio track.
  224.      This is done by means of the International Standard Recording Code (ISO
  225.      3901).  iiiiddddeeeennnntttt is the ISRC and it consists of several fields.  ccccoooouuuunnnnttttrrrryyyy and
  226.      oooowwwwnnnneeeerrrr are encoded in a six-bit format using the 6 least significant
  227.      digits of each byte according to the following table:
  228.  
  229.                 Octal   ASCII      Octal   ASCII      Octal   ASCII
  230.                 ______________    _______________    ______________
  231.                  000      0         023      C         037      O
  232.                  001      1         024      D         040      P
  233.                  002      2         025      E         041      Q
  234.                  003      3         026      F         042      R
  235.                  004      4         027      G         043      S
  236.                  005      5         030      H         044      T
  237.                  006      6         031      I         045      U
  238.                  007      7         032      J         046      V
  239.                  010      8         033      K         047      W
  240.                  011      9         034      L         050      X
  241.                  021      A         035      M         051      Y
  242.                  022      B         036      N         052      Z
  243.  
  244.      yyyyeeeeaaaarrrr and sssseeeerrrriiiiaaaallll are BCD digits in the least significant nibbles of each
  245.      byte.
  246.  
  247.      aaaaffffrrrraaaammmmeeee contains the continuation of the absolute frame numbering from
  248.      mode 1.  This allows an uninterrupted flow of frame numbers.  It contains
  249.      two packed BCD digits.
  250.  
  251. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  252.      cdintro(3dm)
  253.  
  254.      _C_o_m_p_a_c_t _D_i_s_c _D_i_g_i_t_a_l _A_u_d_i_o _S_y_s_t_e_m.  The International Electro-Technical
  255.      Commission (IEC).  Bureau Central de la Commission Electrotechnique
  256.      Internationale, 3 rue de Varemb'e, Gen`eve, Suisse
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.